import 'package:netstorage/model/CommonModel.dart';

class SalesBox {
  String? icon;
  String? moreUrl;
  CommonModel? bigCard1;
  CommonModel? bigCard2;
  CommonModel? smallCard1;
  CommonModel? smallCard2;
  CommonModel? smallCard3;
  CommonModel? smallCard4;

  SalesBox({this.icon,this.moreUrl,this.bigCard1,this.bigCard2,this.smallCard1,this.smallCard2,this.smallCard3,this.smallCard4});
  factory SalesBox.fromJson(Map<String,dynamic> map){
    Map<String,dynamic> bigCard1Map = map['bigCard1'] ?? {};
    Map<String,dynamic> bigCard2Map = map['bigCard2'] ?? {};
    Map<String,dynamic> smallCard1Map = map['smallCard1'] ?? {};
    Map<String,dynamic> smallCard2Map = map['smallCard2'] ?? {};
    Map<String,dynamic> smallCard3Map = map['smallCard3'] ?? {};
    Map<String,dynamic> smallCard4Map = map['smallCard4'] ?? {};
    CommonModel bigCard1 = CommonModel.fromJson(bigCard1Map);
    CommonModel bigCard2 = CommonModel.fromJson(bigCard2Map);
    CommonModel smallCard1 = CommonModel.fromJson(smallCard1Map);
    CommonModel smallCard2 = CommonModel.fromJson(smallCard2Map);
    CommonModel smallCard3 = CommonModel.fromJson(smallCard3Map);
    CommonModel smallCard4 = CommonModel.fromJson(smallCard4Map);
    return SalesBox(
      icon: map['icon'],
      moreUrl: map['moreUrl'],
      bigCard1: bigCard1,
      bigCard2: bigCard2,
      smallCard1: smallCard1,
      smallCard2: smallCard2,
      smallCard3: smallCard3,
      smallCard4: smallCard4,
    );
  }

  Map<String,dynamic> toJson(){
    Map<String,dynamic> ret = {};
    ret['icon'] = icon;
    ret['moreUrl'] = moreUrl;
    ret['bigCard1'] = bigCard1;
    ret['bigCard2'] = bigCard2;
    ret['smallCard1'] = smallCard1;
    ret['smallCard2'] = smallCard2;
    ret['smallCard3'] = smallCard3;
    ret['smallCard4'] = smallCard4;
    return ret;
  }

  @override
  String toString() {
    return 'icon:$icon,moreUrl:$moreUrl,bigCard1:${bigCard1.toString()},bigCard2:${bigCard2.toString()},smallCard1:${smallCard1.toString()},smallCard2:${smallCard2.toString()},smallCard3:${smallCard3.toString()},smallCard4:${smallCard4.toString()}';
  }
}